<template lang="">
  <div>
    <!-- new_details -->
    <!--面包屑导航-->
<div class="breadcrumb">
    <div class="container">
        <h2>
            <a href="">首页</a>&gt;<a href="">公司动态</a>
        </h2>
    </div>
</div>
<!--页面主体-->
<div class="main container">
    <div class="news_details">
        <h2>{{data.title}}</h2>
        <span>发布时间：{{data.pubTime | date}}</span>
        <div class="news_content" v-html="data.content">
        </div>
    </div>
</div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      data: null,
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      const nid = this.$route.params.nid;
      const url = "news_detail.php?nid=" + nid;
      this.axios.get(url).then((res) => {
        console.log(res);
        this.data = res.data;
      });
    },
  },
  // 过滤器
  // filters: {
  //   date(timestamp) {
  //     // *1:参数必须为数字类型 传入的默认是字符串  *1转换为数字
  //     let d = new Date(timestamp * 1);
  //     // 月份取值为0-11 +1变成 1-12
  //     return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
  //   },
  // },
};
</script>
<style lang="">
</style>